export const Status = {
  available: 0,
  borrowed: 1,
  discontinued: 2
};

App({
  machin: {
    screenHeight: 0,
    menuBotton: 0,
    navBarHeight: 0,      // 整个自定义导航栏高度
    statusBarHeight: 0,   // 状态栏高度
    menuTop: 0,           // 胶囊top
    menuHeight: 0,        // 胶囊高度
    menuLeft: 0,         // 胶囊距右侧距离
    menuWidth: 0,          // 胶囊宽度
    tabBarHeight: 100 // 默认tabBar高度
  },
  Authorization: '',
  categoryList: [],
  userInfo: {
	},
	books: [],
  defaultCover: 'https://yuelu-annex.oss-cn-shenzhen.aliyuncs.com/77682426-5fdd-4b17-b8ab-b75dc3b3f75b.jpg',
  onLaunch() {
    const systemInfo = wx.getWindowInfo();
    const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
    // 计算导航栏高度（状态栏+胶囊间距+胶囊高度+下间距）
    this.machin.statusBarHeight = systemInfo.statusBarHeight;
    this.machin.menuTop = menuButtonInfo.top;
    this.machin.menuHeight = menuButtonInfo.height;
    this.machin.menuLeft = menuButtonInfo.left;
    this.machin.menuWidth = menuButtonInfo.width;
    this.machin.navBarHeight = (menuButtonInfo.top - systemInfo.statusBarHeight) * 2 + menuButtonInfo.height + systemInfo.statusBarHeight;
    this.machin.menuBotton = menuButtonInfo.top - systemInfo.statusBarHeight;
    this.machin.tabBarHeight = ( systemInfo.screenHeight - systemInfo.windowHeight - systemInfo.statusBarHeight ) * systemInfo.pixelRatio
		this.machin.screenHeight = systemInfo.screenHeight;
		this.Authorization = wx.getStorageSync('Authorization')
		this.userInfo = wx.getStorageSync('userInfo')
    console.log('导航栏高度:', systemInfo);
    console.log('胶囊信息:', menuButtonInfo);
    console.log('状态栏高度:', this.machin);
  },
    // 检查用户是否已登录
  isLogin() {
    return !!(this.Authorization);
  }
});
